export type ComponentType =
  'input' |
  'inputNumber' |
  'textarea' |
  'cascader' |
  'custom' |
  'select' |
  'tree' |
  'treeSelect' |
  'datepicker' |
  'checkBox' |
  'radio' | 
  'switch'|
  'upload'


const input = defineAsyncComponent(() =>
  import('./src/Input/Input.vue').then((res) => res),
);

const inputNumber = defineAsyncComponent(() =>
  import('./src/InputNumber/InputNumber.vue').then((res) => res),
);

const textarea = defineAsyncComponent(() =>
  import('./src/Textarea/Textarea.vue').then((res) => res),
);

const cascader = defineAsyncComponent(() =>
  import('./src/Cascader/Cascader.vue').then((res) => res),
);

const custom = defineAsyncComponent(() =>
  import('./src/Custom/Custom.vue').then((res) => res),
);

const select = defineAsyncComponent(() =>
  import('./src/Select/Select.vue').then((res) => res),
);

const tree = defineAsyncComponent(() =>
  import('./src/Tree/Tree.vue').then((res) => res),
);

const treeSelect = defineAsyncComponent(() =>
  import('./src/TreeSelect/TreeSelect.vue').then((res) => res),
);

const datepicker = defineAsyncComponent(() =>
  import('./src/Datepicker/Datepicker.vue').then((res) => res),
);

const checkBox = defineAsyncComponent(() =>
  import('./src/CheckBox/CheckBox.vue').then((res) => res),
);

const radio = defineAsyncComponent(() =>
  import('./src/Radio/Radio.vue').then((res) => res),
);

const elSwitch = defineAsyncComponent(() =>
  import('./src/Switch/Switch.vue').then((res) => res),
)
const upload = defineAsyncComponent(() =>
  import('./src/Upload/Upload.vue').then((res) => res),
)

export const componentsMap: Partial<Record<ComponentType, Component>> = {
  input: (props, { attrs, slots }) => {
    return h(input, { ...props, attrs, type: 'default' }, slots);
  },
  inputNumber,
  textarea,
  cascader,
  custom,
  select,
  tree,
  treeSelect,
  datepicker,
  checkBox,
  radio,
  switch: elSwitch,
  upload
}
